package run.siyuan.rocketmq.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import run.siyuan.common.model.rocketmq.Message;
import run.siyuan.rocketmq.producer.ProducerService;

/**
 * RocketMq 发送消息控制器
 *
 * @className: RocketMqController
 * @Description:
 * @author: siyuan
 * @date: 2022/5/24 10:20 AM
 */
@Slf4j
@RestController
public class RocketMqController {

    @Autowired
    private ProducerService producer;

    /**
     * 测试发送消息
     *
     * @return
     */
    @GetMapping("testSend")
    public String testSend(@RequestBody Message message) {
        producer.testSend(message);
        return "success";
    }


    /**
     * 测试 sqlFilter
     *
     * @return
     */
    @GetMapping("testSendSqlFilter")
    public String testSendSqlFilter(@RequestBody Message message) {
        producer.testSendSqlFilter(message);
        return "success";
    }

}